<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>Stockquery</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<script type="text/javascript" src="scripts/jquery/jquery-1.7.1.js"></script>
	<link href="style/authority/basic_layout.css" rel="stylesheet" type="text/css">
	<link href="style/authority/common_style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="scripts/authority/commonAll.js"></script>
	<script type="text/javascript" src="scripts/fancybox/jquery.fancybox-1.3.4.js"></script>
	<script type="text/javascript" src="scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
	<link rel="stylesheet" type="text/css" href="style/authority/jquery.fancybox-1.3.4.css" media="screen"></link>
	<script type="text/javascript" src="scripts/artDialog/artDialog.js?skin=default"></script>
	<script type="text/javascript" src="scripts/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="scripts/Myscripts/alpha_add.js"></script>
	
	<script type="text/javascript">
		var req = false;
		function pressQuery(){
		//alert("here");
			if (window.XMLHttpRequest) {

             req = new XMLHttpRequest();

         }else if (window.ActiveXObject) {

             req = new ActiveXObject("Microsoft.XMLHTTP");

         }
         if(req)
         {
         	var storeroom_name = document.getElementById("storeroom_name_id").value;
  	 		var product_name = document.getElementById("product_name_id").value;
  	 		//alert(storeroom_name+":"+product_name);
  	 		if(storeroom_name!=null&&storeroom_name!=""&&product_name!=null&&product_name!="")
  	 		{
  	 		//alert("here");
  	 		var url = "servlet/Stockqueryservlet?storeroom_name="+encodeURI(encodeURI(storeroom_name))+"&product_name="+encodeURI(encodeURI(product_name));
  	 		req.open("get", url, true);
  	 		req.onreadystatechange = updatePage;
  			req.send(null);
  			}
  			else{
  			alert("请填全信息！");
  			}
         }
		}
		function updatePage(){
			if(req.readyState==4)
			{
				if(req.status=200)
				{
					var res = req.responseText.split(",");
					//alert(res);
					document.getElementById("sumofall_id").innerHTML=res[0];
					document.getElementById("sumofdispatch_id").innerHTML=res[1];
					document.getElementById("sumofnondispatch_id").innerHTML=res[2];
					document.getElementById("sumofreturn_id").innerHTML=res[3];
					alert("已更新！");
				}
			}
		}
	</script>
  </head>
  
  <body>
  <div id = "add_alpha_id">
   <div id="container">
   	 <div class = "ui_content">
   	  <div class = "box_border">
   	   <div id = "box_top">搜索</div>
   		<table class = "table" width="100%">
   			<tr><td>仓库名：</td><td><input class="ui_input_txt02" type="text" id="storeroom_name_id" value=""/></td><td rowspan="2"><input type="button" value ="确定" onclick="pressQuery()" class="ui_input_btn01"/></td></tr>
   			<tr><td>商品名：</td><td><input class="ui_input_txt02" type="text" id = "product_name_id" value=""/></td></tr>
   		</table>
   		</div>
   		</div>
   	<div class = "ui_content">
   	 <div class = "box_border">
   	 
   		<table class = "table" width="100%">
   			<tr><th>总库存量</th><th>已分配数量</th><th>未分配数量</th><th>退回数量</th></tr>
   			<tr><td><lable id = "sumofall_id"></lable></td><td><lable id = "sumofdispatch_id"></lable></td><td><lable id = "sumofnondispatch_id"></lable></td><td><lable id = "sumofreturn_id"></lable></td></tr>
   		</table>
   	 </div>
   	</div>
   </div>
   </div>
   <script type="text/javascript">
   var eitem = document.getElementById("add_alpha_id");
   window.onload = add_alpha(eitem);
   </script>
  </body>
</html>
